# -*- coding: utf-8 -*-
# Description:
# Created: tangyu 2023/6/19
from app.main.dao.sqlalchemy_dao import SQLAlchemyDao

from app.util.result import Result

# 数据库访问层，新加方法调用SQLAlchemyDao中的方法即可
class PerformancePredirtionImitateDao():
    def select_feature_colunms_nogroup(self,modelname):

        """
                查询屈服强度模型的各种参数
                :return:
                """

        sql = """
                select *			
                from CPZLCF.MODELLOAD
                where MODEL_NAME = '{}' and MODEL_LOAD  LIKE '%no_group%'
                """
        sql = sql.format(modelname)
        # if input_list['group_var'] != '':
        #     sql = sql +'and sg_small_class like \'{}%\''.format(input_list['group_var'])
        try:
            data = SQLAlchemyDao.select_all(sql)
        except:
            return Result.error("{}报错".format(sql))
        return data


    @staticmethod
    def select_train_time(modelname):
        sql = """
                            select *				
                            from CPZLCF.T_MX_MODELLIST
                            where model_name = '{}'

                            """
        sql = sql.format(modelname)
        # try:
        data = SQLAlchemyDao.select_all(sql)
        # except:
        #     return Result.error("{}报错".format(sql))
        return data
    def select_feature_colunms_group(self,modelname):

        """
                :return:
                """

        sql = """
                select *				
                from CPZLCF.MODELLOAD
                where MODEL_NAME = '{}' and MODEL_LOAD NOT LIKE '%no_group%'
                """
        sql = sql.format(modelname)
        # if input_list['group_var'] != '':
        #     sql = sql +'and sg_small_class like \'{}%\''.format(input_list['group_var'])
        try:
            data = SQLAlchemyDao.select_all(sql)
        except:
            return Result.error("{}报错".format(sql))
        return data